/*
 * @Description:
 * @Author: Zzt
 * @Date: 2023-02-20 11:23:06
 * @LastEditTime: 2023-02-28 19:57:47
 */
import {
  GET_CHANNEL_LIST,
  GET_ANNOUNCE_LIST,
  SET_SELECT_KEY,
  CELECT_CHANNEL,
  SET_STATUS
} from '../constants';
import { updateItemById } from '@/utils/list';

export const AnnouncementReducer = (state, action) => {
  switch (action.type) {
    case GET_CHANNEL_LIST:
      return {
        ...state,
        channelList: action.data
      };
    case CELECT_CHANNEL:
      return { ...state, noticeTypeId: action.data };
    /* 获取公告列表 */
    case GET_ANNOUNCE_LIST:
      return { ...state, announceList: action.data };
    case SET_SELECT_KEY: {
      return { ...state, selectItems: action.data };
    }
    case SET_STATUS: {
      return { ...state, status: action.data };
    }
    default:
      console.log('untouched', action);
      return state;
  }
};
